﻿<Window x:Class="WMSSoft.WinKStart.Settings_NewEditRegion"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        x:Name="SettingsNewEditRegion" 
        Title="{Binding ViewName}" Height="382" Width="455" ResizeMode="NoResize" ShowInTaskbar="True" WindowStartupLocation="CenterOwner"  Icon="/WinKStart;component/grfx/preferences-other.png" WindowStyle="ToolWindow">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="19*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <StackPanel Grid.Row="1" Orientation="Horizontal" FlowDirection="RightToLeft" >
            <Button Content="{Binding Cmd_ApplyClick.ViewName}" Height="23" HorizontalAlignment="Right" Margin="10,10,5,5" Width="100" IsDefault="True" Command="{Binding Cmd_ApplyClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditRegion}" HorizontalContentAlignment="Center" TabIndex="22" />
            <Button Content="{Binding Cmd_CloseClick.ViewName}" Height="23" HorizontalAlignment="Right" Margin="15,10,0,5" Width="100" IsCancel="True" Command="{Binding Cmd_CloseClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditRegion}" TabIndex="21" />
            <Button Content="{Binding Cmd_OkClick.ViewName}" Height="23" HorizontalAlignment="Right" Margin="5,10,0,5" Width="100" IsCancel="True" Command="{Binding Cmd_OkClick.Command}" CommandParameter="{Binding ElementName=SettingsNewEditRegion}" TabIndex="20" />
        </StackPanel>
        <Grid Margin="10,10,10,0">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="25"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="25"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="109*"/>
                <RowDefinition Height="17*"/>
            </Grid.RowDefinitions>
            <Label Content="Name:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,2,0,0" VerticalAlignment="Top" TabIndex="0"/>
            <TextBox Grid.Column="1" TextWrapping="Wrap" Margin="0,0,0,5" Text="{Binding RegionName}" VerticalContentAlignment="Center"  TabIndex="1" IsEnabled="{Binding CanEditName}"/>
            <Label Content="Type:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,2,0,0" VerticalAlignment="Top" Grid.Row="2" TabIndex="4"/>
            <ComboBox  Margin="0,0,0,5" Grid.Row="2" Grid.Column="1"  SelectedValue="{Binding RegionType}" SelectedValuePath="Key" DisplayMemberPath="Value"  ItemsSource="{Binding RegionTypeItems}" TabIndex="5" />
            <Label Content="Caption:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,1,0,0" VerticalAlignment="Top" Grid.Row="1" TabIndex="2"/>
            <TextBox Grid.Column="1" Grid.Row="1" TextWrapping="Wrap" Margin="0,0,0,5" Text="{Binding RegionCaption}" VerticalContentAlignment="Center" Height="20" TabIndex="3"/>
            <Label Content="DataSource:" HorizontalAlignment="Left" Padding="0,0,0,0" Margin="0,1,0,0" VerticalAlignment="Top" Grid.Row="3" TabIndex="6"/>
            <ComboBox VerticalAlignment="Top"  Margin="0,0,0,5" Grid.Column="1" Grid.Row="3" SelectedValue="{Binding RegionDataSource}" SelectedValuePath="Key" DisplayMemberPath="Value"  ItemsSource="{Binding DataSourceItems}" TabIndex="7"/>
            <Label Content="Filter:" HorizontalAlignment="Left" Margin="0,0,0,0" Padding="0,3,0,5" VerticalAlignment="Top" Grid.Row="4" TabIndex="8"/>
            <Grid Grid.Column="1" Grid.Row="4">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBox x:Name="txt_RegionFilter" Grid.Column="0" TextWrapping="Wrap" Margin="0,0,0,5" Text="{Binding RegionFilter}" VerticalContentAlignment="Center" IsEnabled="{Binding EnableNameChanging}" Height="20" IsReadOnly="True" TabIndex="9" />
                <Button Width="20" Height="20" Grid.Column="1" Content="{Binding Cmd_ChooseFilter.ViewName}" Margin="0,-4,0,0" Padding="0" Command="{Binding Cmd_ChooseFilter.Command}" CommandParameter="{Binding ElementName=txt_RegionFilter}" IsEnabled="{Binding CanChooseFilter}" TabIndex="10" />
            </Grid>
            <Label Content="Navigate:" HorizontalAlignment="Left" Margin="0,4,0,0" Padding="0,0,0,0" VerticalAlignment="Top" Grid.Row="5" TabIndex="11"/>
            <ComboBox VerticalAlignment="Top"  Margin="0,0,0,5" Grid.Column="1" Grid.Row="5" SelectedValue="{Binding NavigationState}" SelectedValuePath="Key" DisplayMemberPath="Value"  ItemsSource="{Binding NavigationStates}" TabIndex="12"/>
            <Label Content="Context-Menu:" Grid.Column="0" Grid.Row="6" Padding="0" Margin="0,3,5,0" TabIndex="13" />
            <ComboBox VerticalAlignment="Top"  Margin="0,0,0,5" Grid.Column="1" Grid.Row="6" SelectedValue="{Binding UseContextMenu}" SelectedValuePath="Key" DisplayMemberPath="Value"  ItemsSource="{Binding ContextMenuStates}" TabIndex="14"/>
            <Label Content="Panels:" HorizontalAlignment="Left" Margin="0,0,0,0" Padding="0,2,0,0" VerticalAlignment="Top" Grid.Row="7" TabIndex="15"/>
            <Grid Grid.Column="1" Grid.Row="7" Margin="0,0,0,0" Grid.RowSpan="2">
                <Grid.RowDefinitions>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <Grid.Resources>
                    <ImageBrush x:Key="AddButtonImageBrush" ImageSource="/WinKStart;component/images/list-add.png" Stretch="Fill"/>
                    <ImageBrush x:Key="EditButtonImageBrush" ImageSource="/WinKStart;component/images/list-edit.png" Stretch="Fill"/>
                    <ImageBrush x:Key="DeleteButtonImageBrush" ImageSource="/WinKStart;component/images/list-remove.png" Stretch="Fill"/>
                </Grid.Resources>
                <ListView x:Name="lst_SelectedPanelItem" Grid.Column="0" Grid.Row="0" ItemsSource="{Binding Panels, Mode=TwoWay}" SelectedItem="{Binding SelectedPanelItem}" Margin="0" TabIndex="16">
                    <ListView.View>
                        <GridView>
                            <GridViewColumn Header="Caption" DisplayMemberBinding="{Binding Caption}" Width="100"/>
                            <GridViewColumn Header="PanelID" DisplayMemberBinding="{Binding PanelID}" Width="90" />
                            <GridViewColumn Header="DataSource" DisplayMemberBinding="{Binding DataSource}" Width="90" />
                            <GridViewColumn Header="Filter" DisplayMemberBinding="{Binding Filter}" Width="90" />
                        </GridView>
                    </ListView.View>
                </ListView>
                <StackPanel Grid.Column="1">
                    <Button Content="" Margin="5,0,0,10" Background="{StaticResource AddButtonImageBrush}" Padding="0,-3,0,0" FontSize="15" VerticalContentAlignment="Center" Height="20" Command="{Binding Cmd_AddClick.Command}" CommandParameter="{Binding ElementName=lst_SelectedPanelItem}" TabIndex="17"/>
                    <Button Content="" Margin="5,0,0,10" Height="20" Background="{StaticResource EditButtonImageBrush}" Command="{Binding Cmd_EditClick.Command}" CommandParameter="{Binding ElementName=lst_SelectedPanelItem}" IsEnabled="{Binding CanEditDeleteSelectedPanelItem}" TabIndex="18" />
                    <Button Content="" Margin="5,0,0,10" Width="20"  Background="{StaticResource DeleteButtonImageBrush}" Command="{Binding Cmd_DeleteClick.Command}" CommandParameter="{Binding ElementName=lst_SelectedPanelItem}" IsEnabled="{Binding CanEditDeleteSelectedPanelItem}" TabIndex="19"/>
                </StackPanel>
            </Grid>
        </Grid>
    </Grid>
</Window>
